<!doctype html>
{% macro header(tag, title) -%}
    <{{ tag }} id="{{ title | lower | replace(' ', '-') }}">
      {{ title }}
      <a href="#{{ title | lower | replace(' ', '-') }}" class="btn"><img src="https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/link.svg"></img></a>
    </{{ tag }}>
{% endmacro %}
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <!-- https://getbootstrap.com/docs/4.1/getting-started/introduction/ -->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  <title>Page Variables</title>
</head>

<body>
  <!--
    This file can be placed in the web root to show what variables and filters are
    available.
  -->
  <div class="container-fluid">

    {{ header('h2', 'Client Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">client.address</td><td class="col-md-8">{{ client.address }}</td></tr>
      <tbody>
    </table>

    {% if client.message_id is defined -%}
    {{ header('h3', 'Client Session Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">client.company_name</td><td class="col-md-8">{{ client.company_name }}</td></tr>
        <tr class="row"><td class="col-md-4">client.email_address</td><td class="col-md-8">{{ client.email_address }}</td></tr>
        <tr class="row"><td class="col-md-4">client.first_name</td><td class="col-md-8">{{ client.first_name }}</td></tr>
        <tr class="row"><td class="col-md-4">client.last_name</td><td class="col-md-8">{{ client.last_name }}</td></tr>
        <tr class="row"><td class="col-md-4">client.is_trained</td><td class="col-md-8">{{ client.is_trained }}</td></tr>
        <tr class="row"><td class="col-md-4">client.message_id</td><td class="col-md-8">{{ client.message_id }}</td></tr>
        <tr class="row"><td class="col-md-4">client.credential_count</td><td class="col-md-8">{{ client.credential_count }}</td></tr>
        <tr class="row"><td class="col-md-4">client.visit_count</td><td class="col-md-8">{{ client.visit_count }}</td></tr>
        <tr class="row"><td class="col-md-4">client.visit_id</td><td class="col-md-8">{{ client.visit_id }}</td></tr>
      <tbody>
    </table>
    {% endif %}

    {% if client.campaign is defined -%}
    {{ header('h3', 'Client Session Campaign Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        {% for key, value in client.campaign.items() -%}
        <tr class="row"><td class="col-md-4">client.campaign.{{ key }}</td><td class="col-md-8">{{ value }}</td></tr>
        {% endfor -%}
      <tbody>
    </table>
    {% endif %}

    {% if client.company is defined -%}
    {{ header('h3', 'Client Session Company Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        {% for key, value in client.company.items() -%}
        <tr class="row"><td class="col-md-4">client.company.{{ key }}</td><td class="col-md-8">{{ value }}</td></tr>
        {% endfor -%}
      <tbody>
    </table>
    {% endif %}

    {{ header('h2', 'Request Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">request.command</td><td class="col-md-8">{{ request.command }}</td></tr>
        <tr class="row">
          <td class="col-md-4">request.cookies</td>
          <td class="col-md-8">
            <ul class="list-group">
            {% for key, value in request.cookies.items() -%}
              <li class="list-group-item">{{ key }} = {{ value }}</li>
            {% endfor -%}
            </ul>
          </td>
        </tr>
        <tr class="row">
          <td class="col-md-4">request.headers</td>
          <td class="col-md-8">
            <ul class="list-group">
            {% for key, value in request.headers.items() -%}
              <li class="list-group-item">{{ key }} = {{ value }}</li>
            {% endfor -%}
            </ul>
          </td>
        </tr>
        <tr class="row">
          <td class="col-md-4">request.parameters</td>
          <td class="col-md-8">
            <ul class="list-group">
            {% for key, value in request.parameters.items() -%}
              <li class="list-group-item">{{ key }} = {{ value }}</li>
            {% endfor -%}
            </ul>
          </td>
        </tr>
      <tbody>
    </table>

    {% if request.credentials is defined -%}
    {{ header('h3', 'Request Credentials Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        {% for key, value in request.credentials.items() -%}
        <tr class="row"><td class="col-md-4">request.credentials.{{ key }}</td><td class="col-md-8">{{ value }}</td></tr>
        {% endfor -%}
      <tbody>
    </table>
    {% endif %}

    {% if request.user_agent -%}
    {{ header('h3', 'Request User Agent Information') }}
    {% set ua_info = parse_user_agent(request.user_agent) %}
    <p>Parse the request's User Agent to obtain details.</p>
    <code>set ua_info = parse_user_agent(request.user_agent)</code>
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">request.user_agent</td><td class="col-md-8">{{ request.user_agent }}</td></tr>
        <tr class="row"><td class="col-md-4">ua_info.os_name</td><td class="col-md-8">{{ ua_info.os_name }}</td></tr>
        <tr class="row"><td class="col-md-4">ua_info.os_version</td><td class="col-md-8">{{ ua_info.os_version }}</td></tr>
        <tr class="row"><td class="col-md-4">ua_info.os_arch</td><td class="col-md-8">{{ ua_info.os_arch }}</td></tr>
      <tbody>
    </table>
    {% endif %}

    {{ header('h2', 'Server Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">server.address</td><td class="col-md-8">{{ server.address }}</td></tr>
        <tr class="row"><td class="col-md-4">server.hostname</td><td class="col-md-8">{{ server.hostname }}</td></tr>
      <tbody>
    </table>

    {{ header('h2', 'Time Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">time.local</td><td class="col-md-8">{{ time.local }}</td></tr>
        <tr class="row"><td class="col-md-4">time.utc</td><td class="col-md-8">{{ time.utc }}</td></tr>
      <tbody>
    </table>

    {{ header('h3', 'Time Filters') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">yesterday</td><td class="col-md-8">{{ time.local | yesterday }}</td></tr>
        <tr class="row"><td class="col-md-4">tomorrow</td><td class="col-md-8">{{ time.local | tomorrow }}</td></tr>
        <tr class="row"><td class="col-md-4">strftime</td><td class="col-md-8">{{ time.local | strftime('%A, %d %B %Y %I:%M%p') }}</td></tr>
      <tbody>
    </table>


    {{ header('h2', 'Miscellaneous Variables') }}
    <table class="table">
      <thead>
        <tr class="row"><th class="col-md-4">Variable</th><th class="col-md-8">Value</th></tr>
      </thead>
      <tbody>
        <tr class="row"><td class="col-md-4">version</td><td class="col-md-8">{{ version }}</td></tr>
      <tbody>
    </table>
  </div>
</body>
</html>
